import request from "@/utils/request";

export function login(data) {
  return request({
    url: "/admin/login",
    method: "post",
    data,
  });
}

export function logout() {
  return request({
    url: "/admin/logout",
    method: "POST",
  });
}

export function listResource(id) {
  return request({
    url: `/role/listResource/${id}`,
    method: "GET",
  });
}

export function allocResource(data) {
  return request({
    url: `/role/allocResource`,
    method: "POST",
    data,
  });
}

// /admin/info

export function info() {
  return request({
    url: `/admin/info`,
    method: "GET",
  });
}
// 公共字典
// 获取下拉字典汇总
export function getClassNewAll(data) {
  return request({
    url: "/common/getClassNewAll",
    method: "GET",
    params: { ...data },
  });
}
// 查询一级字典列表(仿老系统)
export function getDictionary(data) {
  return request({
    url: "/wordBook/getDictionary",
    method: "GET",
    params: { ...data },
  });
}
// 新增一级字典(仿老系统)
export function addDictionary(data) {
  return request({
    url: `/wordBook/addDictionary`,
    method: "POST",
    data,
  });
}
// 查询二级字典列表(仿老系统)
export function getClassmid(data) {
  return request({
    url: "/wordBook/getClassmid",
    method: "GET",
    params: { ...data },
  });
}
// 新增二级字典(仿老系统)
export function addClassmid(data) {
  return request({
    url: `/wordBook/addClassmid`,
    method: "POST",
    data,
  });
}
// 查询三级字典列表(仿老系统)
export function getClassdetail(data) {
  return request({
    url: "/wordBook/getClassdetail",
    method: "GET",
    params: { ...data },
  });
}
// 新增三级字典(仿老系统)
export function addClassdetail(data) {
  return request({
    url: `/wordBook/addClassdetail`,
    method: "POST",
    data,
  });
}
//修改字典
export function updateWordBook(data) {
  return request({
    url: `/wordBook/updateWordBook`,
    method: "POST",
    data,
  });
}
// 删除字典(仿老系统)
export function delClass(data) {
  return request({
    url: "/wordBook/delClass",
    method: "GET",
    params: { ...data },
  });
}